import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Layout from '@/layout/index'

// 静态路由
export const constantRoutes: Array<RouteRecordRaw> = [
  {
    path: '/login',
    component: () => import('@/views/login'),
  },
]

// 动态的异步路由
export const asyncRoutes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/home',
    component: Layout,
    meta: {
      title: '首页',
      isShow: true,
      isHome: true,
    },
    children: [
      {
        path: '/home',
        name: '首页',
        component: () => import('@/views/Home'),
        meta: {
          title: '首页',
          isShow: true,
        },
      },
    ],
  },
  {
    path: '/sss',
    redirect: '/sss',
    component: Layout,
    meta: {
      title: 'test',
      isShow: true,
      isHome: true,
    },
    children: [
      {
        path: '/sss',
        name: 'sss',
        component: () => import('@/views/Home'),
        meta: {
          title: 'test',
          isShow: true,
        },
      },
    ],
  },
]
const router = createRouter({
  routes: constantRoutes,
  history: createWebHashHistory(),
})
export default router
